#include <stdio.h>
#include <stdlib.h>

#define max 5
typedef struct linkqueue
{
	int myue[max-1];
	int front;
	int rear;
}link_queue;

int insertqueue(link_queue *H,int data);

int outqueue(link_queue *H);

int view(link_queue *H);

int main(int argc, const char *argv[])
{
	link_queue *H=(link_queue *)malloc(sizeof(link_queue));
	H->rear=0;
	H->front=0;
	insertqueue(H,8);
	insertqueue(H,9);
	insertqueue(H,10);

	view(H);

	outqueue(H);
	view(H);
	return 0;
}

int insertqueue(link_queue *H,int data)
{
	if((H->rear+1)%max==(H->front))
	{
		printf("full!!!\n");
		return -1;
	}
	H->myue[(H->rear)%max]=data;
	H->rear++;

	return 0;
}
int outqueue(link_queue *H)
{
	if(H->rear%max==H->front)
	{
		printf("empty\n");
		return -1;
	}
	H->front++;

	return 0;
}
int view(link_queue *H)
{
	for(int i=H->front;i<H->rear;i++)
	{
		printf("%d ",H->myue[i]);
	}

	return 0;
}
